package com.sunwayhorizo.health.business.registries.organization.query;

import java.util.List;

import javax.ejb.Local;

import com.sunwayhorizo.health.hl7.common.Hl7Exception;
import com.sunwayhorizo.health.hl7.rim.Organization;
import com.sunwayhorizo.health.hl7.rim.Role;

@Local
public interface DepartmentQueryLocal {
	
	/**
	 * 查询所有的工作组
	 * @return
	 * @throws Hl7Exception
	 */
	public List<Role> findWorkGroupAll() throws Hl7Exception;
	
	/**
	 * 只查询科室
	 * @param orgId
	 * @return
	 * @throws Hl7Exception
	 */
	public List<Role> findOnlyDepartment(String orgId) throws Hl7Exception;
	
	/**
	 * 根据机构查询所有的科室，工作组
	 * @param orgId
	 * @return
	 * @throws Hl7Exception
	 */
	public List<Role> findDepartmentOrWorkGroupByOrgId(String orgId) throws Hl7Exception;
	
	/**
	 * 查询所有已经启动的科室，工作组
	 * @param orgId
	 * @return
	 * @throws Hl7Exception
	 */
	public List<Role> findActiveDeptOrWgByOrgId(String orgId) throws Hl7Exception;
	
    /**
     * 根据科室实体id集合查询科室角色
     * 
     * @param orgIds
     * @return
     */
    @SuppressWarnings("rawtypes")
    public List<Role> findListOrg(List orgIds) throws Hl7Exception;
    
    /**
     * 根据科室编码查询科室是否存在
     * 
     * @param code
     * @return
     * @throws Hl7Exception
     */
    public Organization findOrganizationByCode(String code) throws Hl7Exception;
    
    /**
     * 根据科室类型属性查询对应的工作组
     * 
     * @param codingSchemesEnName
     *            科室类型术语英文名称
     * @param conceptCode
     *            科室类型编码
     * @return List<Role>
     * @throws Hl7Exception
     */
    public List<Role> findRoleListByCond(String codingSchemesEnName, String conceptCode) throws Hl7Exception;
    
    
    /**
     * 根据科室id拿到工作组的实体id
     * @param deptId
     * @return
     * @throws Hl7Exception
     */
    public List<Object> findWoroGroupIdsByDeptId(String deptId) throws Hl7Exception;
    
    /**
     * 根据工作组编码查询工作组角色
     * @param workGroupCode
     * @return
     * @throws Hl7Exception
     */
    public Role findWorkGroupRoleByWorkGroupCode(String workGroupCode) throws Hl7Exception;
    
    /**
     * 根据科室查询下面是否有工作组
     * 
     * @param orgIds
     * @return
     * @throws Hl7Exception
     */
    @SuppressWarnings("rawtypes")
    public boolean findDepartByDeptIds(List deptIds) throws Hl7Exception;
    
    /**
     * 根据科室id查询出所有的scope ids
     * 
     * @param deptIds
     * @return
     * @throws Hl7Exception
     */
    @SuppressWarnings("rawtypes")
    public List<Long> findEntityIdByRoleIds(List deptIds) throws Hl7Exception;
    
    /**
     * 查询工作组下面是否有员工,有true,没有false
     * 
     * @param depts
     *            科室id集合
     * @return
     * @throws Hl7Exception
     */
    @SuppressWarnings("rawtypes")
    public boolean findPersonByOrgIds(List depts) throws Hl7Exception;
    
    /**
     * 根据科室编码查询科室
     * 
     * @param code
     * @return
     * @throws Hl7Exception
     */
    public Organization findDepartmentByCode(String code) throws Hl7Exception;
    
    /**
     * 根据科室编码查询科室角色Role
     * @param code 科室编码
     * @return
     * @throws Hl7Exception
     */
    public Role findOrgRoleByCode(String code) throws Hl7Exception;
}
